package com.cloudm.technician.ui.modules.cloudm_box.machine_history

import android.os.Bundle
import com.cloudm.technician.R
import com.cloudm.technician.data.model.DeviceInfo
import com.cloudm.technician.ui.base.BaseAdapter
import com.cloudm.technician.ui.base.BaseListFragment
import kotlinx.android.synthetic.main.common_fragment_list.*

/**
 * 作者: wesley
 * 时间: 2017/12/25
 * 描述: ui
 */
class MachineHistoryFragment : BaseListFragment<MachineHistoryPresenter, DeviceInfo>(),
        MachineHistoryContract.View {

    override val enabledRefresh: Boolean
        get() = true

    companion object {
        fun newInstance() = MachineHistoryFragment()
    }

    override fun onItemClick(t: DeviceInfo) {

    }

    override fun createAdapter(): BaseAdapter<DeviceInfo> = MachineHistoryAdapter()

    override fun loadData() {
        presenter?.getMachineHistoryInfo(startPage, PAGE_SIZE)
    }

    override fun initInject() {
        DaggerMachineHistoryComponent.builder().appComponent(
                appComponent).machineHistoryPresenterModule(
                MachineHistoryPresenterModule(this)).build().inject(this)
    }

    override fun handleBundle(bundle: Bundle) {

    }

    override fun initEmptyResource() {
        viewStub.layoutResource = R.layout.empty_machine_view
    }
}